#-*- coding utf-8 -*-

import xlrd
import csv
'''
with open('cna131fresultados.csv','rb') as csvfile:
    
    leitor = csv.reader(csvfile)
    for linha in leitor:
        print linha

'''  
book = xlrd.open_workbook("cna131fresultados.xls")
sh = book.sheet_by_name('Resultados')
i=0


for rownum in range(sh.nrows):
       for colnum in range(sh.ncols):
              values=sh.cell_value(rownum,colnum)
              #data.append(values)
              
              #data.decode(encoding='utf-8')
              #data.append(values)
              print values
    
             
              '''
              if isinstance(values,unicode):
                    values=values.encode('utf-8')
                    data.append(values)
                    #print value
                    
                    wr.writerow(data)
            '''
 
'''
    for i in range(len(data)):
       for x in range(len(data[i])):
          wr.writerow(i,x,str(data[i][x]))
'''
'''cna131fresultados = open('cna131fresultados.csv','wb')
wr=csv.write(csvfile, quoting = csv.QUOTE_ALL)
      data.append(str(sh.row_values(rownum)))
       data.append(str(sh.row_values(rownum)))

 for i in range(len(data)):
       print len(data[i])
       for j in range(len(data[i])):
           wr.writerow(str(data[i][j]))
           
wr.writerow(sh.row_values(rownum))
print sh.row_values(rownum)
          print sh.col_values(colnum)
          
csvfile.close()
'''
'''
book = xlrd.open_workbook("cna131fresultados.xls")
print "the number of worksheets is",book.nsheets
print "worksheet name(s):",book.sheet_names()
sh=book.sheet_by_index(0)
print sh.name,sh.nrows,sh.ncols
'''
